<?php

namespace App\Models;

use DateTimeInterface;

class GoldModel extends RbhBaseModel
{
    protected $table = 'df_gold';

    protected $guarded = [];

    /**
     * @param DateTimeInterface $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date): string
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    /**
     * 创建金币记录
     * @param $order_no
     * @param $uid
     * @param $gold
     * @param $remark
     * @param $status
     * @return mixed
     */
    public static function createGold($order_no, $uid, $gold, $remark, $status): mixed
    {
        return self::create([
            'order_no'  => $order_no,
            'uid'       => $uid,
            'gold'      => $gold,
           'remark'     => $remark,
           'status'     => $status
        ]);
    }
}
